##
##  $Header: /pub/cvsroot/mydns/doc/Makefile.am,v 1.35 2002/09/20 20:03:01 bboy Exp $
##

MAN_PAGES		=	mydns.conf.5 mydns.8 mydnscheck.8 mydnsexport.8 mydnsimport.8

SUBDIRS			=	texi

EXTRA_DIST		=	$(MAN_PAGES:=.in) \
						support/texi2html support/texi2html.init \
						nls/es/mydns.conf.5.in nls/es/mydns.8.in nls/es/mydnscheck.8.in \
							nls/es/mydnsexport.8.in nls/es/mydnsimport.8.in

TARGETDIRS		=	man

SEDFILE 			=	../version.sed

RUN				=	$(SHELL) $(top_srcdir)/missing --run


targetdirs:
	for d in $(TARGETDIRS); do if ! test -d $$d; then mkdir $$d; fi; done

## Creates a small .sed script to replace various variables
sedvars:
	if ! `test -f $(SEDFILE)`; then cd .. && make sedfile; fi

vars: targetdirs sedvars

manpages: $(MAN_PAGES:=.in)
	for f in $(MAN_PAGES); do \
	  srcdir=.; \
	  if ! test -z "$$LANG"; then \
	    if test -f nls/$$LANG/$$f.in; then \
	      srcdir=nls/$$LANG; \
	    else \
	      lng=`echo $$LANG | $(RUN) sed -e 's/_..//'`; \
	      if test -f nls/$$lng/$$f.in; then \
	        srcdir=nls/$$lng; \
	      fi; \
	    fi; \
	  fi; \
	  $(RUN) sed -f $(SEDFILE) $$srcdir/$$f.in > man/$$f; \
	done

all: vars manpages

clean:
	rm -rf $(TARGETDIRS) variables.sed
	rm -f *~ core*

man-install: manpages
	for f in $(MAN_PAGES); do \
	  if test -f man/$$f; then \
	    $(INSTALL) -d $(DESTDIR)$(mandir)/man`echo $$f | sed -e 's/^.*\\.//'`; \
	    $(INSTALL_DATA) man/$$f $(DESTDIR)$(mandir)/man`echo $$f | sed -e 's/^.*\\.//'`/$$f; \
	  fi; \
	done

install: all man-install
	cd texi && make install

ps:
	cd texi && make ps

pdf:
	cd texi && make pdf

## Target the author uses to install docs on the homepage:
release: vars manpages
	rm -f @WEBROOT@/doc/man/*.[0-9] && cp -a man/*.[0-9] @WEBROOT@/doc/man

## vi:set ts=3:
